package com.atguigu.filter;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.io.IOException;


/**
 * @auther zzyy
 * @create 2025-01-03 13:32
 */
@Component
@Slf4j
@WebFilter(urlPatterns = "/*")
public class DemoFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
            throws IOException, ServletException {
        log.info("Filter 进入");
        filterChain.doFilter(request, response);
        log.info("Filter 退出");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}